import {
  onBeforeMount,
  onMounted,
  onBeforeUpdate,
  onUpdated,
  onBeforeUnmount,
  onUnmounted,
} from "vue";

export default function useLifeCycleTest(name: string) {
  console.log(`${name} 组件创建`);
  onBeforeMount(() => {
    console.log(`${name} 组件挂载前`);
  });
  onMounted(() => {
    console.log(`${name} 组件挂载后`);
  });
  onBeforeUpdate(() => {
    console.log(`${name} 组件更新前`);
  });
  onUpdated(() => {
    console.log(`${name} 组件更新后`);
  });
  onBeforeUnmount(() => {
    console.log(`${name} 组件卸载前`);
  });
  onUnmounted(() => {
    console.log(`${name} 组件卸载后`);
  });
}
